package com.xxx.modules.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xxx.modules.mapper.VacateMapper;
import com.xxx.modules.entity.Vacate;
import com.xxx.modules.service.VacateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import java.util.List;
import java.util.Arrays;
import com.xxx.modules.utils.TimeUtil;

/**
 * vacate
 *
 * @author 北易航
 * @since 1.0.0 2022-12-28
 */
@Service
public class VacateServiceImpl extends ServiceImpl<VacateMapper, Vacate> implements VacateService {

    @Autowired
    private VacateMapper vacateMapper;


    @Override
    public PageInfo<Vacate> selectVacateInfo(Vacate vacate, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Vacate> data = vacateMapper.selectListInfo(vacate);
        return new PageInfo<>(data);
    }

    @Override
    public void saveVacateInfo(Vacate vacate) {
        vacate.setCreateTime(TimeUtil.getCurrentTime());
        vacate.setStatus("1");
        vacateMapper.insert(vacate);
    }

    @Override
    public void updateVacateInfo(Vacate vacate) {
        vacateMapper.updateById(vacate);
    }

    @Override
    public void delVacateInfo(Integer id) {
        vacateMapper.deleteById(id);
    }

    @Override
    public void delBatchVacateInfo(String idList) {
        List<String> list = Arrays.asList(idList.split(","));
        vacateMapper.deleteBatchIds(list);
    }


}